﻿using System;
using ProtoBuf;

namespace Wise.TimeWarrior.DTO
{
    /// <summary>
    /// Dto representing working day info
    /// </summary>
    [ProtoContract]
    [Serializable]
    public class WorkingDayDto
    {
        /// <summary>
        /// When DTO has been created
        /// </summary>
        [ProtoMember(1)]
        public DateTime CreationDateTime { set; get; }
        /// <summary>
        /// Firs event loged on bussiness day
        /// </summary>
        [ProtoMember(2)]
        public UserEventDto FirstAction { set; get; }
        /// <summary>
        /// LAst action  loged on business day
        /// </summary>
        [ProtoMember(3)]
        public UserEventDto LastAction { set; get; }
        /// <summary>
        /// <see cref="object.ToString"/>
        /// </summary>
        public override string ToString()
        {
            return string.Format("Created: {0}, First Action: {1} at {2} {3}", CreationDateTime, FirstAction.UserAction, FirstAction.EventDate, LastAction != null ? string.Format(" , Last Action: {0} at {1} ", LastAction.UserAction, LastAction.EventDate) : string.Empty);
        }
    }
}
